import sys,traceback,Ice
Ice.loadSlice("Printer.ice")
import QuerySystem

class QueryResultsI(QuerySystem.QueryResults):
    def QueryByNo(self,s,current=None):
        print(s)
        dict = {"English":100,"Math":100}
        return dict
        

status = 0
ic = None
try:
    ic = Ice.initialize(sys.argv)
    adapter = ic.createObjectAdapterWithEndpoints("SimplePrinterAdapter","default -p 10000")
    object = QueryResultsI()
    adapter.add(object,ic.stringToIdentity("SimplePrinter"))
    adapter.activate()
    ic.waitForShutdown()
except:
    traceback.print_exc()
    status = 1

if ic:
    try:
        ic.destroy()
    except:
        traceback.print_exc()
        status = 1
sys.exit(status)
